﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>"%>
<%@ Import Namespace="System.Collections.Generic"%>  
<%@ Import Namespace="SeguroSoft.Models"%>
<%@ Import Namespace="SeguroSoft.Model.Model"%>
<script runat="server">


    protected void Button2_Click(object sender, EventArgs e)
    {

    }
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Busqueda
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    

    <h2>Resultados
    </h2>
    <%Dictionary<RevisionTecnica, string> revisiones = Model; List<string> tiempoEspera=new List<string>();List<string> costo=new List<string>(); List<string> tipo = new List<string>(); %>
    <%foreach (RevisionTecnica r in revisiones.Keys)
      {
          tiempoEspera.Add(r.TiempoEspera);
          costo.Add(r.Costo);
          tipo.Add(r.TipoRevision);
      }  %>

      <form action="/RevisionTecnica/BusquedaFiltrada" method="post" >
      <fieldset><legend>Filtrar</legend>
      Tiempo:<select style='width: 120px;' name="TiempoEspera" onchange="this.form.submit()">
            <option value="0" selected></option>
            <%  foreach (string tiempo in tiempoEspera)
                { %>
            <option value="<%: tiempo%>">
                <%= Html.Encode(tiempo)%>
            </option>
            <% } %></select>

            Costo:<select style='width: 120px;' name="Costo" onchange="this.form.submit()">
            <option value="0" selected></option>
            <%  foreach (string cost in costo)
                { %>
            <option value="<%: cost%>">
                <%= Html.Encode(cost)%>
            </option>
            <% } %></select>
            
            TipoRevision:<select style='width: 120px;' name="TipoRevision" onchange="this.form.submit()">
            <option value="N/A" selected></option>
            <%  foreach (string tiporev in tipo)
                { %>
            <option value="<%: tiporev%>">
                <%= Html.Encode(tiporev)%>
            </option>
            <% } %></select>



      </fieldset>
      </form>
    <table align="center" cellpadding="10" cellspacing="0">
        <tr style="color: #FFFFFF">
            <th style="background-color: #1D728F">Detalles</th>
            <th style="background-color: #1D728F">
                ID  
            </th>
            <th style="background-color: #1D728F">
                Direccion  
            </th>
            <th style="background-color: #1D728F">
                Comuna  
            </th>
            <th style="background-color: #1D728F">
                TiempoEspera  
            </th>
            <th style="background-color: #1D728F">
                Costo  
            </th>
            <th style="background-color: #1D728F">
                TipoRevision  
            </th>
            <th style="width: 67px; background-color: #1D728F;">
                Compañia  
            </th>
            <th style="width: 35px; background-color: #1D728F;">
                Comparar</th>
        </tr>

   
    <%int i = 0; %>
    <% foreach (RevisionTecnica item in revisiones.Keys)
       {
           i++; %>
    
        <tr>
            <td align="center" style="background-color: #56BEE0">
                
                <span style="color: #183AA2">
                
                <%: Html.ActionLink("Detalles", "Detalles", new { id=item.IDRevisionTecnica })%> 
                
            </td>
            <td align="center" style="background-color: #56BEE0">
                <span style="color: #183AA2">
                <%: item.IDRevisionTecnica %>
                </span>
            </td>
            <td align="center" style="background-color: #56BEE0">
                <span style="color: #183AA2">
                <%: item.Calle %>
                </span>
            </td>
            <td align="center" style="background-color: #56BEE0">
                <span style="color: #183AA2">
                <%: item.Comuna %>
                </span>
            </td>
            <td align="center" style="background-color: #56BEE0">
                <span style="color: #183AA2">
                <%: item.TiempoEspera %>
                </span>
            </td>
            <td align="center" style="background-color: #56BEE0">
                <span style="color: #183AA2">
                <%: item.Costo %>
                </span>
            </td>
            <td align="center" style="background-color: #56BEE0">
                <span style="color: #183AA2">
                <%: item.TipoRevision %>
                </span>

            </td>
            <td style="width: 67px; background-color: #56BEE0;" align="center">
                <span style="color: #183AA2">
                <%: revisiones[item] %>
                </span>
            </td>
            <td style="width: 35px; background-color: #56BEE0;" align="center">
                <input type="checkbox" value="<%=Html.Encode(item.IDRevisionTecnica)%>" 
                    name="compararCheckBox" style="color: #183AA2"/><span 
                    style="color: #183AA2"> </span>
            </td>
        </tr>
    
    <% } %>

    </table>

      <form action="/RevisionTecnica/Comparar" method="post">
    <p>
        &nbsp;</p>
    <p>
    
        <input type="submit" class="buttonC" name="BotonComparar"  value="Comparar" 
            align="right"/>
        </p>
   <%=Html.ActionLink("Volver a Busqueda", "")%>
    </form>

</asp:Content>

